package com.ithei.date.mydate;

import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;

public class LocalDateTime成员方法 {
    public static void main(String[] args) {
        LocalDateTime ldt=LocalDateTime.now();
        int year = ldt.getYear();
        System.out.println("年份: "+year);
        int monthValue = ldt.getMonthValue();
        System.out.println("月份: "+monthValue);
        int dayOfMonth = ldt.getDayOfMonth();
        System.out.println("月份中的天数: "+dayOfMonth);
        int dayOfYear = ldt.getDayOfYear();
        System.out.println("年中的天数:  "+dayOfYear);
        DayOfWeek dayOfWeek = ldt.getDayOfWeek();
        int value = dayOfWeek.getValue();
        System.out.println("星期数:    "+value);
        System.out.println("星期几:    "+dayOfWeek);
        int minute = ldt.getMinute();
        System.out.println("分钟: "+minute);
        int hour = ldt.getHour();
        System.out.println("小时: "+hour);
        int second = ldt.getSecond();
        System.out.println("秒数为:    "+second);


    }

    public static void datelocal(){
        //年月日时分秒
        LocalDateTime ldt=LocalDateTime.now();
        //只要年月日
        LocalDate ld=ldt.toLocalDate();
        //只要时分秒
        LocalTime lt=ldt.toLocalTime();
    }
}
